//Based on the tutorial at:
//http://artis.imag.fr/Membres/Xavier.Decoret/resources/ode/tutorial1.html

#ifndef OBJECT_H
#define OBJECT_H

#include <ode/ode.h>
#include <GL/glut.h>
#include <cml/cml.h>
#include <vector>
#include "Vertex.h"
#include "Vec3.h"
class Object
{
public:
	Object();

	/// Create an Object comprised of the given verts and indices
	/// @param verts a reference to a vector of vertices that make up the object
	/// @param indices a reference to a vector of GLuints that index the vertices
	Object(std::vector<Vertex> &verts, std::vector<GLuint> &indices);

	/// Deconstructor for Object
	virtual ~Object();

	dBodyID body;
	dGeomID geom;

	unsigned char color[3];

	
	std::vector<Vertex> vertices; ///< The verticies that make up the object
	
	std::vector<GLuint> indices; ///< The indicies that specify the draw order of the object

	/// Sets up the OpenGL matrices to render the object
	/// then makes a call to renderInLocalFrame,
	/// an abstract method that must be implemented by
	/// classes deriving from object
	void render() const;

	/// Sets the position of the object's body within the simulation
	/// @param x the x location
	/// @param y the y location
	/// @param z the z location
	void setPosition(dReal x, dReal y, dReal z);
	const dReal *getPosition();

protected:
	/// Abstract method that handles the actual
	/// drawing of an object. This is implemented
	/// by classes inheriting from object and should
	/// draw those classes appropriately
	virtual void renderInLocalFrame() const = 0 ;
	

};

#endif //OBJECT_H

